import Phaser from 'phaser';
import { Preloader } from "@/views/game/game02/preloader";
import { GameOverScene } from "@/views/game/game02/scenes/GameOverScene";
import { HudScene } from "@/views/game/game02/scenes/HudScene";
import { MainScene } from "@/views/game/game02/scenes/MainScene";
import { MenuScene } from "@/views/game/game02/scenes/MenuScene";
import { SplashScene } from "@/views/game/game02/scenes/SplashScene";

// Find out more information about the Game Config at:
// https://docs.phaser.io/api-documentation/typedef/types-core#gameconfig
const config = {
    type: Phaser.AUTO,
    parent: "phaser-container",
    width: 960,
    height: 540,
    backgroundColor: "#1c172e",
    pixelArt: true,
    roundPixel: false,
    max: {
        width: 800,
        height: 600,
    },
    scale: {
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH
    },
    physics: {
        default: "arcade",
        arcade: {
            gravity: { y: 0 }
        }
    },
    scene: [
        Preloader,
        SplashScene,
        MainScene,
        MenuScene,
        HudScene,
        GameOverScene
    ]
};

const StartGame = (parent) => {

    return new Phaser.Game({ ...config, parent });
}

export default StartGame;
